<script>
export default {
  onLaunch: function () {
    console.log("App Launch");
    let token = uni.getStorageSync("token");
    if (token) {
      //存在则关闭启动页进入首页
      try {
        plus.navigator.closeSplashscreen();
      } catch (error) {}
    } else {
      //不存在则跳转至登录页
      uni.reLaunch({
        url: "/pages/login/login",
        success: () => {
          try {
            plus.navigator.closeSplashscreen();
          } catch (e) {
            //TODO handle the exception
          }
        },
      });
    }
  },
  onShow: function () {
    // console.log('App Show')
    // const token = uni.getStorageSync('token');
    // if (token) {
    //   uni.navigateTo({
    //     url: "/pages/login/login.vue"
    //   })
    // }
  },
  onHide: function () {
    console.log("App Hide");
  },
};
</script>

<style lang="scss">
@import "uview-ui/index.scss";

/*每个页面公共css */
.btn {
  transition: all 0.2s;

  &:active {
    filter: brightness(80%);
    transform: scale(0.95);
  }
}
</style>
